<div ng-controller="shopAddCtrl">
    <div class="bg-light lter b-b wrapper-md ng-scope">
        <h4 class="m-n font-thin">添加门店</h4>
    </div>
    <div class="wrapper-md">
        <div class="panel panel-body padder-md">
            <!--<div class="shop_header_container">-->
                <!--<div class="shop_header_item shop_header_item_active">-->
                    <!--<span class="shop_header_item_span">主体商户用户</span>-->
                    <!--<div class="tran-right"></div>-->
                <!--</div>-->
                <!--<div class="shop_header_item">-->
                    <!--<div class="tran-left"></div>-->
                    <!--<span class="shop_header_item_span">完善店铺营业资质</span>-->
                <!--</div>-->
            <!--</div>-->

            <!--商品类型-->
            <form name="shopAddForm" class="form-validation" ng-submit="addShop()">
                <div class="m-b-sm">
                    <div class="padder-md padder-v bg-light m-b">
                        <span class="font-bold m-r-xs text-muted"><p class="sp-step">1</p>基本主体信息</span>
                        <label class="m-b-n">(每个手机号仅能申请一个帐号)<i class="m-l-xs fa fa-question-circle text-muted" popover-placement="top" popover="请填写未加盟的手机号" popover-trigger="mouseenter"></i></label>
                    </div>
                    <div>
                        <div class="form-horizontal">
                            <div class="form-group">
                                <label class="col-sm-1 control-label">手机号</label>
                                <div class="col-sm-4">
                                    <input type="text" name="mobilePhone" ng-model="systemUserAddVO.mobilePhone" class="form-control m-b-xs" placeholder="请输入手机号" ng-pattern="/^1[34578]\d{9}$/" required>
                                    <div ng-if="shopAddForm.mobilePhone.$touched">
                                        <p ng-if="shopAddForm.mobilePhone.$error.required" class="text-danger h6 m-t-sm">手机号是必需的</p>
                                        <p class="text-danger h6 m-t-sm"  ng-if="shopAddForm.mobilePhone.$error.pattern">请填写正确的手机号</p>
                                        <p class="text-danger h6 m-t-sm" ng-if="!shopAddForm.mobilePhone.$error.required && !shopAddForm.mobilePhone.$error.pattern && failSend">手机号码已经被使用</p>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">手机验证码</label>
                                <div class="col-sm-4">
                                    <div class="inline">
                                        <input type="text" name="code" ng-model="systemUserAddVO.code" class="form-control m-b-xs w-md pull-left m-r-xs" placeholder="请输入手机验证码" required>
                                        <div class="btn btn-success pull-left" ng-click="sendAuthCode()" ng-bind="description" ng-disabled="sendSuccess"></div>
                                    </div>
                                    <div ng-if="shopAddForm.code.$touched">
                                        <p ng-if="shopAddForm.code.$error.required" class="text-danger h6">手机验证码是必需的</p>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">邮箱</label>
                                <div class="col-sm-4">
                                    <input type="text" name="email" ng-model="systemUserAddVO.email" class="form-control m-b-xs" placeholder="请输入邮箱" required>
                                    <div ng-if="shopAddForm.email.$touched">
                                        <p ng-if="shopAddForm.email.$error.required" class="text-danger h6 m-t-sm">邮箱是必需的</p>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">用户名</label>
                                <div class="col-sm-4">
                                    <input type="text" name="name" ng-model="systemUserAddVO.name" class="form-control m-b-xs" placeholder="请输入用户名" required>
                                    <div ng-if="shopAddForm.name.$touched">
                                        <p ng-if="shopAddForm.name.$error.required" class="text-danger h6 m-t-sm">用户名是必需的</p>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">性别</label>
                                <div class="col-md-4">
                                    <div class="m-b-sm">
                                        <div class="inline m-r-xs">
                                            <div class="radio inline m-n">
                                                <label class="i-checks i-checks-sm">
                                                    <input type="radio" name="gender" ng-model="systemUserAddVO.gender" value="0">
                                                    <i></i>
                                                    女
                                                </label>
                                            </div>
                                        </div>
                                        <div class="inline">

                                            <div class="radio inline m-n">
                                                <label class="i-checks i-checks-sm">
                                                    <input type="radio" name="gender" ng-model="systemUserAddVO.gender" value="1">
                                                    <i></i>
                                                    男
                                                </label>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">密码</label>
                                <div class="col-sm-4">
                                    <input type="password" class="form-control" placeholder="请输入密码" name="password" maxlength="16" ng-model="systemUserAddVO.password" ng-minlength="6" ng-maxlength="16" required>
                                    <div ng-if="shopAddForm.password.$touched">
                                        <label class="pull-left text-left text-danger h6 l-h m-t-sm"  ng-if="shopAddForm.password.$error.required">密码为必填项</label>
                                        <label class="pull-left text-left text-danger h6 l-h m-t-sm"  ng-if="shopAddForm.password.$error.minlength || shopAddForm.password.$error.maxlength">密码长度最少为6位数,最长为16位数</label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">确认密码</label>
                                <div class="col-sm-4">
                                    <input type="password" class="form-control" placeholder="请再次输入密码" name="confirmPassword" maxlength="16" ng-model="systemUserAddVO.confirmPassword" required>
                                    <div ng-if="shopAddForm.confirmPassword.$touched">
                                        <label class="pull-left text-left text-danger h6 l-h m-t-sm"  ng-if="shopAddForm.confirmPassword.$error.required">确认密码为必填项</label>
                                        <label class="pull-left text-left text-danger h6 l-h m-t-sm"  ng-if="!shopAddForm.confirmPassword.$error.required && systemUserAddVO.confirmPassword != systemUserAddVO.password">密码与确认密码不一致</label>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>

                </div>

                <div class="m-b-sm">
                    <div class="padder-md padder-v bg-light m-b">
                        <span class="font-bold m-r-xs text-muted"><p class="sp-step">2</p>店铺基本信息</span>
                    </div>
                    <div>
                        <div class="form-horizontal form-validation">
                            <div class="form-group">
                                <label class="col-sm-1 control-label">店铺名称</label>
                                <div class="col-sm-4">
                                    <input type="text" name="shopName" ng-model="shopAddVO.name" class="form-control m-b-xs" placeholder="请输入店铺名称" required>
                                    <div ng-if="shopAddForm.shopName.$touched">
                                        <p ng-if="shopAddForm.shopName.$error.required" class="text-danger h6 m-t-sm">店铺名称是必需的</p>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">联系人电话</label>
                                <div class="col-sm-4">
                                    <input type="text" name="shopPhone" ng-model="shopAddVO.mobilePhone" class="form-control m-b-xs" placeholder="请输入联系人电话" ng-pattern="/^1[34578]\d{9}$/" required>
                                    <div ng-if="shopAddForm.shopPhone.$touched">
                                        <p ng-if="shopAddForm.shopPhone.$error.required" class="text-danger h6 m-t-sm">联系人电话是必需的</p>
                                        <p ng-if="shopAddForm.shopPhone.$error.pattern" class="text-danger h6 m-t-sm" >请填写正确的手机号</p>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">选择行业</label>
                                <div class="col-sm-4">
                                    <select class="input-sm form-control m-b-sm" ng-model="shopAddVO.industryId" name="industryId" ng-options="item.id as item.fullName for item in industry" required>
                                        <option value="">请选择分类</option>
                                    </select>
                                    <div ng-if="shopAddForm.industryId.$touched">
                                        <label class="pull-left text-left text-danger h6 l-h"  ng-if="shopAddForm.industryId.$error.required">请选择分类</label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">店铺归属地区</label>
                                <div class="col-sm-4">
                                    <div class="w-full text-left">
                                        <div class="w-full btn-group dropdown m-b-sm">
                                            <div ng-click="findProvinces(0,0)" name="address" class="w-full text-left form-control dropdown-toggle">
                                                {{selectProvice}}/{{selectTown}}/{{selectCounty}}
                                            </div>
                                        </div>
                                        <tabset class="tab-container h5 bg-white m-n" ng-if="showState">
                                            <tab heading="省" active="steps.step1">
                                                <div class="padder-md padder-v row" >
                                                    <div class="col-md-4 m-b-xs text-center" ng-repeat="item in provinces">
                                                        <div class="btn btn-sm" ng-click="findTown(1,item)">{{item.name}}</div>
                                                    </div>
                                                </div>
                                            </tab>
                                            <tab heading="市" active="steps.step2">
                                                <div class="padder-md padder-v row" >
                                                    <div class="col-md-4 m-b-xs text-center" ng-repeat="item in towns">
                                                        <div class="btn btn-sm" ng-click="findCounty(2,item)">{{item.name}}</div>
                                                    </div>
                                                    <div class="panel-body" ng-if="towns.length<=0">
                                                        - 请先选择省级 -
                                                    </div>
                                                </div>
                                            </tab>
                                            <tab heading="区" active="steps.step3">
                                                <div class="padder-md padder-v row" >
                                                    <div class="col-md-4 m-b-xs text-center" ng-repeat="item in countys">
                                                        <div class="btn btn-sm" ng-click="CountyHide(item)">{{item.name}}</div>
                                                    </div>
                                                    <div class="panel-body" ng-if="countys.length<=0">
                                                        - 请先选择市级 -
                                                    </div>
                                                </div>
                                            </tab>
                                        </tabset>
                                        <div>
                                            <span class="block text-danger h6" ng-if="!showState && currentState==0">*请先选择省</span>
                                            <span class="block text-danger h6" ng-if="!showState && currentState==1">*请先选择市</span>
                                            <span class="block text-danger h6" ng-if="!showState && currentState==2">*请先选择区</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">自行添加商品</label>
                                <div class="col-sm-4">
                                    <div class="pull-left">
                                        <label class="i-switch m-t-xs m-r">
                                            <input type="checkbox"  ng-model="shopAddVO.isCustomGoods" ng-true-value="1" ng-false-value="0" ng-disabled="shopAddVO.isReserve==1">
                                            <i></i>
                                        </label>
                                    </div>
                                    <label class="pull-left m-t-xs" ng-bind="{1:'允许',0:'不允许'}[shopAddVO.isCustomGoods]"></label>
                                </div>
                            </div>

                            <!--<div class="form-group">-->
                                <!--<label class="col-sm-1 control-label">是否直邮</label>-->
                                <!--<div class="col-sm-4">-->
                                    <!--<div class="pull-left">-->
                                        <!--<label class="i-switch m-t-xs m-r">-->
                                            <!--<input type="checkbox"  ng-model="shopAddVO.isMail" ng-true-value="1" ng-false-value="0">-->
                                            <!--<i></i>-->
                                        <!--</label>-->
                                    <!--</div>-->
                                    <!--<label class="pull-left m-t-xs" ng-bind="{1:'已开启',0:'未开启'}[shopAddVO.isMail]"></label>-->
                                <!--</div>-->
                            <!--</div>-->

                            <!--<div class="form-group">-->
                                <!--<label class="col-sm-1 control-label">是否到店</label>-->
                                <!--<div class="col-sm-4">-->
                                    <!--<div class="pull-left">-->
                                        <!--<label class="i-switch m-t-xs m-r">-->
                                            <!--<input type="checkbox"  ng-model="shopAddVO.isShop" ng-true-value="1" ng-false-value="0">-->
                                            <!--<i></i>-->
                                        <!--</label>-->
                                    <!--</div>-->
                                    <!--<label class="pull-left m-t-xs" ng-bind="{1:'已开启',0:'未开启'}[shopAddVO.isShop]"></label>-->
                                <!--</div>-->
                            <!--</div>-->

                            <div class="form-group">
                                <label class="col-sm-1 control-label">是否配送</label>
                                <div class="col-sm-4">
                                    <div class="pull-left">
                                        <label class="i-switch m-t-xs m-r">
                                            <input type="checkbox"  ng-model="shopAddVO.isDelivery" ng-true-value="1" ng-false-value="0" >
                                            <i></i>
                                        </label>
                                    </div>
                                    <label class="pull-left m-t-xs" ng-bind="{1:'已开启',0:'未开启'}[shopAddVO.isDelivery]"></label>
                                </div>
                            </div>

                            <!--<div class="form-group">-->
                                <!--<label class="col-sm-1 control-label">是否堂食</label>-->
                                <!--<div class="col-sm-4">-->
                                    <!--<div class="pull-left">-->
                                        <!--<label class="i-switch m-t-xs m-r">-->
                                            <!--<input type="checkbox"  ng-model="shopAddVO.isEat" ng-true-value="1" ng-false-value="0" >-->
                                            <!--<i></i>-->
                                        <!--</label>-->
                                    <!--</div>-->
                                    <!--<label class="pull-left m-t-xs" ng-bind="{1:'已开启',0:'未开启'}[shopAddVO.isEat]"></label>-->
                                <!--</div>-->
                            <!--</div>-->

                            <!--<div class="form-group">-->
                                <!--<label class="col-sm-1 control-label">是否预定</label>-->
                                <!--<div class="col-sm-10">-->
                                    <!--<div class="pull-left">-->
                                        <!--<label class="i-switch m-t-xs m-r">-->
                                            <!--<input type="checkbox"  ng-model="shopAddVO.isReserve" ng-true-value="1" ng-false-value="0" ng-click="open()">-->
                                            <!--<i></i>-->
                                        <!--</label>-->
                                    <!--</div>-->
                                    <!--<label class="pull-left m-t-xs" ng-bind="{1:'已开启',0:'未开启'}[shopAddVO.isReserve]"></label>-->
                                    <!--<label class=" control-label m-t-xs text-info h6 ">(需同步开启门店自行添加商品)</label>-->
                                <!--</div>-->
                            <!--</div>-->
                            <div class="form-group" ng-if="check()">
                                <label class="col-sm-2 control-label text-danger h6 ">*请至少选择一项服务类型</label>
                            </div>
                        </div>
                    </div>
                </div>


                <div class="m-b-sm">
                    <div class="padder-md padder-v bg-light m-b">
                        <span class="font-bold m-r-xs text-muted"><p class="sp-step">3</p>商户的套餐选择</span>
                    </div>
                    <div class="inline">
                        <div class="pull-left b-a w-md text-center panel-body re-con m-r-md pos-rlt" ng-class="{true:'re-con-active',false:''}[index==$index]" ng-repeat="meal in setMeal">
                            <div ng-click="chooseSetMeal(meal.id,$index)">
                                <div class="m-b-md">
                                    <span class="font-bold block m-b-sm">{{meal.name}}</span>
                                    <p class="h2 font-bold m-b-sm text-success">￥{{meal.money|number:2}}</p>
                                </div>
                                <div class="m-xs">
                                    <span class="block text-muted h6 m-b-sm bar-conbefore-active bar-conafter-active"><p class="padder inline">套餐福利</p></span>
                                    <div class="b-a panel-body h6 l-h text-left he-con">
                                        <div ng-bind-html="meal.content | ntobr |trustHtml"></div>
                                    </div>
                                </div>
                                <div class="tri-bar l-h fa fa-check text-white"></div>
                            </div>
                        </div>
                    </div>
                    <div>
                        <div>
                            <circle-loading ng-if="loading"></circle-loading>
                        </div>
                    </div>
                </div>

                <div class="w-full inline b-t">
                    <div class="col-sm-4 padder-v col-sm-offset-2">
                        <button type="submit" class="btn btn-success"  ng-disabled="shopAddForm.$invalid || setMealId == null || currentState!=3 || check()">下一步</button>
                        <div class="btn btn-success" ng-if="addState" disabled>保存中..</div>
                    </div>
                </div>
            </form>


        </div>
    </div>
</div>